home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / amos / AMCAFExa.lha / AMCAF_Examples / ShadeBobs2.AMOS / ShadeBobs2.amosSourceCode
Encoding:
AMOS Source Code  |  1996-01-17  |  3.0 KB  |  89 lines

  1. ' ************************************* Commands used: 
  2. ' *                                   * Turbo Draw         =Qcos 
  3. ' *           Amcaf Examples          * Blitter Fill 
  4. ' *         Shade Bobs 2 V1.1         * Blitter Clear
  5. ' *      Written by Chris Hodges      * Shade Bob Up 
  6. ' *                                   * Shade Bob Down 
  7. ' ************************************* =Qsin
  8. '                          
  9. ' Hide the mouse cursor
  10. Hide 
  11. ' First open a little screen to draw some objects
  12. Screen Open 0,64,64,2,Lowres
  13. Curs Off : Flash Off : Paper 0 : Pen 1 : Cls 
  14. ' We don't want the user to see the drawing process, so we hide the screen.
  15. Screen Hide 
  16. ' Now draw some shapes and pick them up. 
  17. ' I is the counter of the BOB number.
  18. I=1
  19. ' We'll need 16 frames, and we must rotate the star 45 degrees.
  20. For A=0 To 127 Step 8
  21.   ' Draw the edges 
  22.   For B=0 To 16
  23.     ' Every second egde must be inside.
  24.     If B and 1
  25.       X2=32+ Extension_8_1114(A+B*64,31) : Y2=32+ Extension_8_1106(A+B*64,31)
  26.     Else 
  27.       X2=32+ Extension_8_1114(A+B*64,16) : Y2=32+ Extension_8_1106(A+B*64,10)
  28.     End If 
  29.     ' Draw the line in Blitter Mode. 
  30.     If B
  31.        Extension_8_1016 X1,Y1 To X2,Y2,1,-1
  32.     End If 
  33.     X1=X2 : Y1=Y2
  34.   Next 
  35.   ' Fill the shape.
  36.    Extension_8_1042 0,0
  37.   ' And take it out. 
  38.   Get Bob I,0,0 To 64,64
  39.   ' Set the Hot Spot to the middle 
  40.   Hot Spot I,31,31
  41.   ' And increase the image counter.
  42.   Inc I
  43.   ' Clear the screen to allow a new star to be drawn.
  44.    Extension_8_121C 0,0
  45. Next 
  46. ' Now we open the screen, we want to draw the shade bobs on. 
  47. ' This screen should have many colours, and must be single buffered. 
  48. Screen Open 0,320,256,32,Lowres
  49. Curs Off : Flash Off : Paper 0 : Pen 1 : Cls 
  50. ' Create a nice looking palette. 
  51. For A=0 To 7 : Colour A,A*2 : Next 
  52. For A=0 To 7 : Colour A+8,A*$20+$F : Next 
  53. For A=0 To 7 : Colour A+16,$1FF+A*$200 : Next 
  54. For A=0 To 7 : Colour A+24,$FFF-A*$222 : Next 
  55. ' These are the three angles, we use to create some sine flying path.  
  56. W1=0 : W2=512 : W3=256
  57. ' These angles are needed for the shade bob, that wipes out the old bob. 
  58. F1=0 : F2=512 : F3=256
  59. ' I is again an image pointer, and T is to count the frames. 
  60. I=1 : T=0
  61. Repeat 
  62.   ' Wait Vbl to sychronisize to the raster beam. 
  63.   Wait Vbl 
  64.   ' Move the star by adding something to the angles. 
  65.   Add W1,9
  66.   Add W2,7
  67.   Add W3,4
  68.   ' Calculate a basic sine flying path.  
  69.   X= Extension_8_1114(W1, Extension_8_1106(W1-W3,160))+160 : Y= Extension_8_1106(W3+W1, Extension_8_1106(W1-W2,128))+128
  70.   ' Draw the Shade Bob on screen 0 at coords x,y using image I.
  71.    Extension_8_0F84 0,X,Y,I
  72.   ' Increase the frame value...
  73.   Inc T
  74.   ' Is it time to kill the old bobs? 
  75.   If T>128
  76.     ' Follow exactly the same path, by adding the same values. 
  77.     Add F1,9
  78.     Add F2,7
  79.     Add F3,4
  80.     ' Also, use the same formula.
  81.     X= Extension_8_1114(F1, Extension_8_1106(F1-F3,160))+160 : Y= Extension_8_1106(F3+F1, Extension_8_1106(F1-F2,128))+128
  82.     ' And draw the bob.
  83.      Extension_8_0F9E 0,X,Y,I
  84.   End If 
  85.   ' Increase the bob image.
  86.   Add I,1,1 To 16
  87. Until Inkey$=Chr$(27) or Mouse Key<>0
  88. Screen Close 0
  89. End